package cn.chi.base.controller;

import cn.chi.base.service.ILoginService;
import cn.chi.org.domain.Employee;
import cn.chi.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private ILoginService loginService;
    @Autowired
    private RedisTemplate redisTemplate;
    @RequestMapping("/log")
    public AjaxResult login(@RequestBody Employee employee){
        // 调用service验证进行登录
        try {
            loginService.login(employee);
            return AjaxResult.me();
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.me().setMessage(e.getMessage());
        }

    }
}
